import request from '@/axios/request'
import url from '@/axios/url'
const { mesUrl, adminUrl, minioUrl } = url()

// 导出url
export const exportUrl = `${mesUrl}mesMaterialStationModel/export`

// 列表查询
export function getDataList (params = {}) {
  return request({
    url: `${mesUrl}mesMaterialStationModel/list`,
    method: 'get',
    params
  })
}

// 获取树状结构
export function getTree (params = {}) {
  return request({
    url: `${adminUrl}baseFactoryModeling/tree`,
    method: 'get',
    params
  })
}
// 获取树状结构
export function getTreeByFactory (params = {}) {
  return request({
    url: `${adminUrl}baseFactoryModeling/treeFactory`,
    method: 'get',
    params
  })
}



// 获取详情
export function getInfo (id = '') {
  return request({
    url: `${mesUrl}mesMaterialStationModel/` + id,
    method: 'get'
  })
}

// 批量删除
export function submitDelete (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialStationModel/delete`,
    method: 'post',
    data
  })
}

// 新增
export function submitCreate (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialStationModel/create`,
    method: 'post',
    data
  })
}

// 修改
export function submitEdit (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialStationModel/edit`,
    method: 'post',
    data
  })
}

// 查询1启用0停用列表
export function getStatusList () {
  return request({
    url: `${adminUrl}dict/type/active_status`,
    method: 'get'
  })
}
// 查询单位列表
export function getUnitList () {
  return request({
    url: `${adminUrl}dict/type/units`,
    method: 'get',
  });
}
// 查询类型列表
export function getTypeCodeList (params = {}) {
  params["status"] = '1';
  return request({
    url: `${mesUrl}mesMaterialStationType/list`,
    method: 'get',
    params
  });
}
// 查询系统建模列表
export function getFactoryMoldingList (params = {}) {
  params["status"] = '1';
  return request({
    url: `${adminUrl}baseFactoryModeling/tree`,
    method: 'get',
    params
  });
}
// 查询级别
export function getModelingLevel () {
  return request({
    url: `${adminUrl}dict/type/factory_modeling_level`,
    method: 'get',
  });
}
export function importData (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialStationModel/import`,
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    }
  })
}
// export const downloadTemplateUrl = `${mesUrl}mesMaterialStationModel/exportTemplate`
export const downloadTemplateUrl = `${minioUrl}/mes-template/料站模型上传模版.xls`
